.class public Lorg/microemu/app/classloader/ChangeCallsClassVisitor;
.super Lorg/objectweb/asm/ClassAdapter;
.source "ChangeCallsClassVisitor.java"


# static fields
.field static class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

.field static class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

.field static final javaVersion:Ljava/util/Map;


# instance fields
.field config:Lorg/microemu/app/classloader/InstrumentationConfig;


# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 47
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    .line 50
    sget-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v1, Ljava/lang/Integer;

    const v2, 0x3002d

    invoke-direct {v1, v2}, Ljava/lang/Integer;-><init>(I)V

    const-string v2, "1.1"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 51
    sget-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v1, Ljava/lang/Integer;

    const v2, 0x3002e

    invoke-direct {v1, v2}, Ljava/lang/Integer;-><init>(I)V

    const-string v2, "1.2"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 52
    sget-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v1, Ljava/lang/Integer;

    const/16 v2, 0x2f

    invoke-direct {v1, v2}, Ljava/lang/Integer;-><init>(I)V

    const-string v2, "1.3"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 53
    sget-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v1, Ljava/lang/Integer;

    const/16 v2, 0x30

    invoke-direct {v1, v2}, Ljava/lang/Integer;-><init>(I)V

    const-string v2, "1.4"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 54
    sget-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v1, Ljava/lang/Integer;

    const/16 v2, 0x31

    invoke-direct {v1, v2}, Ljava/lang/Integer;-><init>(I)V

    const-string v2, "1.5"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 55
    sget-object v0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v1, Ljava/lang/Integer;

    const/16 v2, 0x32

    invoke-direct {v1, v2}, Ljava/lang/Integer;-><init>(I)V

    const-string v2, "1.6"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 56
    return-void
.end method

.method public constructor <init>(Lorg/objectweb/asm/ClassVisitor;Lorg/microemu/app/classloader/InstrumentationConfig;)V
    .locals 0
    .parameter "cv"
    .parameter "config"

    .prologue
    .line 59
    invoke-direct {p0, p1}, Lorg/objectweb/asm/ClassAdapter;-><init>(Lorg/objectweb/asm/ClassVisitor;)V

    .line 60
    iput-object p2, p0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->config:Lorg/microemu/app/classloader/InstrumentationConfig;

    .line 61
    return-void
.end method

.method static class$(Ljava/lang/String;)Ljava/lang/Class;
    .locals 2
    .parameter "x0"

    .prologue
    .line 71
    :try_start_0
    invoke-static {p0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
    :try_end_0
    .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    return-object v1

    :catch_0
    move-exception v0

    .local v0, x1:Ljava/lang/ClassNotFoundException;
    new-instance v1, Ljava/lang/NoClassDefFoundError;

    invoke-direct {v1}, Ljava/lang/NoClassDefFoundError;-><init>()V

    invoke-virtual {v1, v0}, Ljava/lang/NoClassDefFoundError;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v1

    throw v1
.end method


# virtual methods
.method public visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
    .locals 4
    .parameter "version"
    .parameter "access"
    .parameter "name"
    .parameter "signature"
    .parameter "superName"
    .parameter "interfaces"

    .prologue
    .line 65
    and-int/lit16 v1, p1, 0xff

    const/16 v2, 0x31

    if-lt v1, v2, :cond_0

    .line 66
    sget-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->javaVersion:Ljava/util/Map;

    new-instance v2, Ljava/lang/Integer;

    invoke-direct {v2, p1}, Ljava/lang/Integer;-><init>(I)V

    invoke-interface {v1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    .line 67
    .local v0, v:Ljava/lang/String;
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    const-string v2, "Loading MIDlet class "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, " of version "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    move-result-object v1

    if-nez v0, :cond_2

    const-string v2, ""

    :goto_0
    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lorg/microemu/log/Logger;->warn(Ljava/lang/String;)V

    .line 69
    .end local v0           #v:Ljava/lang/String;
    :cond_0
    iget-object v1, p0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->config:Lorg/microemu/app/classloader/InstrumentationConfig;

    invoke-virtual {v1}, Lorg/microemu/app/classloader/InstrumentationConfig;->isEnhanceThreadCreation()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 70
    const-string v1, "java/lang/Thread"

    invoke-virtual {p5, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_4

    .line 71
    sget-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

    if-nez v1, :cond_3

    const-string v1, "org.microemu.app.util.MIDletThread"

    invoke-static {v1}, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v1

    sput-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

    :goto_1
    invoke-static {v1}, Lorg/microemu/app/classloader/ChangeCallsMethodVisitor;->codeName(Ljava/lang/Class;)Ljava/lang/String;

    move-result-object p5

    .line 76
    :cond_1
    :goto_2
    invoke-super/range {p0 .. p6}, Lorg/objectweb/asm/ClassAdapter;->visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V

    .line 77
    return-void

    .line 67
    .restart local v0       #v:Ljava/lang/String;
    :cond_2
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    const-string v3, " "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v2

    goto :goto_0

    .line 71
    .end local v0           #v:Ljava/lang/String;
    :cond_3
    sget-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

    goto :goto_1

    .line 72
    :cond_4
    const-string v1, "java/util/Timer"

    invoke-virtual {p5, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 73
    sget-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

    if-nez v1, :cond_5

    const-string v1, "org.microemu.app.util.MIDletTimer"

    invoke-static {v1}, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v1

    sput-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

    :goto_3
    invoke-static {v1}, Lorg/microemu/app/classloader/ChangeCallsMethodVisitor;->codeName(Ljava/lang/Class;)Ljava/lang/String;

    move-result-object p5

    .restart local p5
    goto :goto_2

    :cond_5
    sget-object v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

    goto :goto_3
.end method

.method public visitMethod(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Lorg/objectweb/asm/MethodVisitor;
    .locals 3
    .parameter "access"
    .parameter "name"
    .parameter "desc"
    .parameter "signature"
    .parameter "exceptions"

    .prologue
    .line 81
    new-instance v0, Lorg/microemu/app/classloader/ChangeCallsMethodVisitor;

    invoke-super/range {p0 .. p5}, Lorg/objectweb/asm/ClassAdapter;->visitMethod(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Lorg/objectweb/asm/MethodVisitor;

    move-result-object v1

    iget-object v2, p0, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;->config:Lorg/microemu/app/classloader/InstrumentationConfig;

    invoke-direct {v0, v1, v2}, Lorg/microemu/app/classloader/ChangeCallsMethodVisitor;-><init>(Lorg/objectweb/asm/MethodVisitor;Lorg/microemu/app/classloader/InstrumentationConfig;)V

    return-object v0
.end method
